home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / initialLayout.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  10.8 KB  |  366 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Aug 12 1996
  22. //  Author:         cdg
  23. //
  24. //  Description:
  25. //      This script creates the UI for the main window on startup.
  26. //
  27. //  Input Arguments:
  28. //      None.
  29. //
  30. //  Return Value:
  31. //      None.
  32. //
  33. //    Note:
  34. //        None.
  35. // 
  36. {
  37.     int $printMemoryExists = `exists printMemory`;
  38.     if ($printMemoryExists) {
  39.         printMemory("Static initializers complete");
  40.     }
  41.     global string $gMainWindow = "";
  42.     global string $gCommandWindow = "CommandWindow";
  43.  
  44.     //
  45.     //  Determine values for initial setup states
  46.     //
  47.     int $buildMainWindow = !`optionVar -q mainWindowDisable`;
  48.  
  49.     //
  50.     //  Get the window positions before creating any windows
  51.     //
  52.     windowPref -enableAll `optionVar -q saveWindowPos`;
  53.     if (`optionVar -q saveWindowPos`) {
  54.         windowPref -loadAll;
  55.     }
  56.     
  57.     // Force out of xformNoSelect mode            
  58.     selectPref -xformNoSelect off; 
  59.  
  60.     //
  61.     //  Start building the application UI.
  62.     //
  63.  
  64.     if (`exists setDefaultTemplates`) { 
  65.         eval "source setDefaultTemplates"; 
  66.     }
  67.  
  68.     setStartupMessage("Initializing Script Editor.");
  69.     if (`exists initCommandWindow`) eval "source initCommandWindow"; 
  70.  
  71.     if ($buildMainWindow && `exists initMainWindow`)    { 
  72.  
  73.         source initMainWindow; 
  74.  
  75.         source initContexts; 
  76.  
  77.         if (`isTrue "AnimationExists"` && `exists animationStartup`) { 
  78.             eval "source animationStartup"; 
  79.         }
  80.  
  81.         ////////////////////////////////////////////////////////////
  82.         //
  83.         //    Attribute Editor
  84.         //
  85.         ////////////////////////////////////////////////////////////
  86.         if(`exists initAttributeEditor`) {
  87.             if($printMemoryExists) {
  88.                 printMemory("Attribute Editor Start");
  89.             }
  90.             setStartupMessage("Initializing Attribute Editor");
  91.             eval "source initAttributeEditor";
  92.             if ($printMemoryExists) {
  93.                 printMemory("Attribute Editor Complete");
  94.             }
  95.         }
  96.  
  97.         ////////////////////////////////////////////////////////////
  98.         //
  99.         //    Tool Settings
  100.         //
  101.         ////////////////////////////////////////////////////////////
  102.         if(`exists initToolSettings`) {
  103.             if($printMemoryExists) {
  104.                 printMemory("Tool Settings Start");
  105.             }
  106.             setStartupMessage("Initializing Tool Settings");
  107.             eval "source initToolSettings";
  108.             if ($printMemoryExists) {
  109.                 printMemory("Tool Settings Complete");
  110.             }
  111.         }
  112.  
  113.         ////////////////////////////////////////////////////////////
  114.         //
  115.         //    Channel Box and Layer Editor Area.
  116.         //
  117.         ////////////////////////////////////////////////////////////
  118.         if(`exists initChannelsLayers`) {
  119.             if($printMemoryExists) {
  120.                 printMemory("Channel Box and Layer Editor Start");
  121.             }
  122.             setStartupMessage("Initializing Channel Box and Layer Editor");
  123.             eval ("source initChannelsLayers");
  124.             if ($printMemoryExists) {
  125.                 printMemory("Channel Box and Layer Editor Complete");
  126.             }
  127.         }
  128.  
  129.         ////////////////////////////////////////////////////////////
  130.         //
  131.         //    Main window view panes.
  132.         //
  133.         ////////////////////////////////////////////////////////////
  134.         if (`exists initMainPane`) { 
  135.             setStartupMessage("Initializing View Panes.");
  136.             eval "source initMainPane"; 
  137.             if ($printMemoryExists) {
  138.                 printMemory("Main Pane Complete");
  139.             }
  140.         }
  141.  
  142.         ////////////////////////////////////////////////////////////
  143.         //
  144.         //    Panels.
  145.         //
  146.         ////////////////////////////////////////////////////////////
  147.         if (`exists initPanels`) { 
  148.             setStartupMessage("Initializing Panels.");
  149.             eval "source initPanels"; 
  150.             if ($printMemoryExists) {
  151.                 printMemory("Panels Complete");
  152.             }
  153.         }
  154.  
  155.         ////////////////////////////////////////////////////////////
  156.         //
  157.         //    Status line.
  158.         //
  159.         ////////////////////////////////////////////////////////////
  160.  
  161.         if (`exists initStatusLine`) { 
  162.             setStartupMessage("Initializing Status Line.");
  163.             eval "source initStatusLine"; 
  164.             if ($printMemoryExists) {
  165.                 printMemory("Status Line Complete");
  166.             }
  167.         }
  168.  
  169.         ////////////////////////////////////////////////////////////
  170.         //
  171.         //    Time slider and Playback range.
  172.         //
  173.         ////////////////////////////////////////////////////////////
  174.         if (`isTrue "AnimationExists"` && `exists initTimeSlider` ) { 
  175.             setStartupMessage("Initializing Time Slider.");
  176.             eval "source initTimeSlider"; 
  177.             eval "source initPlaybackRange"; 
  178.         }
  179.  
  180.         ////////////////////////////////////////////////////////////
  181.         //
  182.         //    Command line.
  183.         //
  184.         ////////////////////////////////////////////////////////////
  185.         if (`exists initCommandLine` ) { 
  186.             setStartupMessage("Initializing Command Line.");
  187.             eval "source initCommandLine"; 
  188.         }
  189.  
  190.         ////////////////////////////////////////////////////////////
  191.         //
  192.         //    Shelf.
  193.         //
  194.         ////////////////////////////////////////////////////////////
  195.         if (`exists initShelf`) { 
  196.             if ($printMemoryExists) {
  197.                 printMemory("Shelf Start");
  198.             }
  199.             setStartupMessage("Initializing Shelf.");
  200.             eval "source initShelf"; 
  201.             if ($printMemoryExists) {
  202.                 printMemory("Shelf Complete");
  203.             }
  204.         }
  205.  
  206.         ////////////////////////////////////////////////////////////
  207.         //
  208.         //    Help line.
  209.         //
  210.         ////////////////////////////////////////////////////////////
  211.         if (`exists initHelpLine`) { 
  212.             setStartupMessage("Initializing Help Line.");
  213.             eval "source initHelpLine"; 
  214.         }
  215.  
  216.         ////////////////////////////////////////////////////////////
  217.         //
  218.         //    Toolbox.
  219.         //
  220.         ////////////////////////////////////////////////////////////
  221.         if (`exists initHelpLine`) { 
  222.             setStartupMessage("Initializing Toolbox.");
  223.             eval "source toolbox"; 
  224.         }
  225.     }
  226.  
  227.     if (`exists initAuxiliary`) { 
  228.         eval "source initAuxiliary";
  229.     }
  230.  
  231.     //  Set minor nodes that will not appear in Maya UI.
  232.     //
  233.     if (`exists initMinorNodeTypes`) {
  234.         eval "source initMinorNodeTypes";
  235.     }
  236.  
  237.     if (`window -exists $gMainWindow`) {
  238.         if (`exists initMainMenuBar`)  { 
  239.             if ($printMemoryExists) {
  240.                 printMemory("Menu Bar Start");
  241.             }
  242.             setStartupMessage("Initializing Menu Bar.");
  243.             source initMainMenuBar;
  244.             if ($printMemoryExists) {
  245.                 printMemory("Menu Bar Complete");
  246.             }
  247.         }
  248.  
  249.         setStartupMessage("Initializing Colors.");
  250.         if (`exists initColors`) eval "source initColors"; 
  251.  
  252.         setStartupMessage("Initializing Manipulators.");
  253.         if (`exists initManipulators`) eval "source initManipulators";
  254.  
  255.         // Map the main window after initColors or refresh callbacks
  256.         // on color changes will cause startup to be slow
  257.         //
  258.         setStartupMessage("Showing Maya Window.");
  259.         showWindow $gMainWindow;
  260.  
  261.         // Launch the Learning Movies page
  262.         //
  263.         if (`exists mayaLearningMoviesPage`) { 
  264.             if (!`optionVar -exists showLearningMoviesOnStartup`) {
  265.                 optionVar -intValue showLearningMoviesOnStartup true;
  266.             }
  267.             if (`optionVar -query showLearningMoviesOnStartup` == true) {
  268.                 evalDeferred "mayaLearningMoviesPage";
  269.             }
  270.         }
  271.  
  272.         //  Initialize each modeling panel to color-index mode
  273.         //
  274.         string $modelPanels[] = `getPanel -type modelPanel`;
  275.         for ( $modelPanel in $modelPanels ) {
  276.             modelEditor -edit -useColorIndex true $modelPanel;
  277.         }
  278.  
  279.         updateUIComponentCloseButtons();
  280.     }
  281.  
  282.     //  These globals are used internally and need to be declared in advance.
  283.     //
  284.     global string $gBuffStr;
  285.     global string $gBuffStr0;
  286.     global string $gBuffStr1;
  287.     global string $gBuffStrArr[];
  288.  
  289.     // Not sure where to declare this, so..
  290.     //
  291.     // This variable is used to store the last action
  292.     // the user performed, or the last tool that they
  293.     // were using before switching to another tool
  294.     //
  295.     // Note: Really the global variable $gSelect should be used instead
  296.     // of hard coding selectSuperContext but the syntax doesn't allow it.
  297.     //
  298.     global string $gLastAction = "setToolTo selectSuperContext";
  299.  
  300.     // This variable stores the current working mode of maya
  301.     //
  302.     global string $gMayaMode;
  303.     $gMayaMode = `optionVar -q mayaMode`;
  304.  
  305.     // 
  306.     // Make sure the UI reflects the working mode of the previous session
  307.     //
  308.     workingMode $gMayaMode;
  309.  
  310.     // The next variable is used to allow the user to
  311.     // quickly return to a 'working' keyframe.  This
  312.     // allows user to scrub through time to evaluate the
  313.     // effects of changing/setting a keyframe, and 
  314.     // quickly return to that frame to make further
  315.     // changes, if necessary. 
  316.     //
  317.     global float $gCurrentWorkingFrame = 1;
  318.     if ($printMemoryExists) {
  319.         printMemory("Layout complete");
  320.     }
  321.  
  322.     // Initialize the help broswer
  323.     //
  324.     global int    $gUseHelpBrowserWin;
  325.     global int    $gRaiseHelpBrowserWin;
  326.     global string $gHelpBrowserWinID = "";
  327.  
  328.     $gUseHelpBrowserWin = `optionVar -q helpBrowserUseWindow`;
  329.     $gRaiseHelpBrowserWin = `optionVar -q helpBrowserRaiseWindow`;
  330.  
  331.     // Initialize the last saved states for the UI elements.
  332.     // On startup the last saved state is the same as the
  333.     // current state. After one 'Hide UI Elements' is done
  334.     // they will be different.  These states are set earlier
  335.     // in this file so don't move this stuff up. The strange
  336.     // syntax is to get around the restriction that globals
  337.     // be initialized with a constant.
  338.     //
  339.     global int $gLastStateComponentBar;
  340.     global int $gLastStateStatusLine;
  341.     global int $gLastStateShelf;
  342.     global int $gLastStateTimeSlider;
  343.     global int $gLastStatePlaybackRange;
  344.     global int $gLastStateCommandLine;
  345.     global int $gLastStateHelpLine;
  346.     global int $gLastStateToolbox;
  347.     global int $gLastStateAE;
  348.     global int $gLastStateToolSettings;
  349.     global int $gLastStateChannelsLayers;
  350.  
  351.     $gLastStateStatusLine     = isUIComponentVisible("Status Line");
  352.     $gLastStateShelf          = isUIComponentVisible("Shelf");
  353.     $gLastStateTimeSlider     = isUIComponentVisible("Time Slider");
  354.     $gLastStatePlaybackRange  = isUIComponentVisible("Range Slider");
  355.     $gLastStateCommandLine    = isUIComponentVisible("Command Line");
  356.     $gLastStateHelpLine       = isUIComponentVisible("Help Line");
  357.     $gLastStateToolbox        = isUIComponentVisible("Tool Box");
  358.     $gLastStateAE             = isUIComponentVisible("Attribute Editor");
  359.     $gLastStateToolSettings   = isUIComponentVisible("Tool Settings");
  360.     $gLastStateChannelsLayers = isUIComponentVisible("Channel Box / Layer Editor");
  361.  
  362.     //  Initialize selection masks
  363.     //
  364.     source selectionMaskStackInit;
  365. }
  366.